<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="alert alert-info">公告列表</div>
<div class="clearfix" style="margin-bottom: 25px;">
	<a href="${pageContext.request.contextPath}/AddNoticeServlet" class="pull-right btn btn-primary">添加</a>
</div>
<table class="table table-bordered">
	<tr>
		<th>公告编号</th>
		<th>公告标题</th>
		<th>公告内容</th>
		<th>时间</th>
		<th>操作</th>
	</tr>
	<c:forEach items="${notices}" var="item">
	<tr>
		<td><c:out value="${item.id}" /></td>
		<td><c:out value="${item.title}" /></td>
		<td width="700"><c:out value="${item.details}" /></td>
		<td><c:out value="${item.n_time.toLocaleString()}" /></td>
		<td>
			<a href="${pageContext.request.contextPath}/EditNoticeServlet?id=${item.id}" class="btn btn-primary">编辑</a>
			<a href="${pageContext.request.contextPath}/DeleteNoticeServlet?id=${item.id}" class="btn btn-danger">删除</a>
		</td>
	</tr>
	</c:forEach>
</table>
<nav>
  <ul class="pager">
  	<c:if test="${hasPrev}">
  		<li class="previous"><a href="${pageContext.request.contextPath}/FindAllNotices?page=${_page - 1}"><span aria-hidden="true">&larr;</span>上一页</a></li>
  	</c:if>
  	<c:if test="${hasNext}">
    	<li class="next"><a href="${pageContext.request.contextPath}/FindAllNotices?page=${_page + 1}">下一页 <span aria-hidden="true">&rarr;</span></a></li>
  	</c:if>
  </ul>
</nav>